<? include ("../init.php") ?>
<? include ("../header.php") ?>
<? include ("../menu.php") ?>
<? include ("submenu.php") ?>

<div id = "body">

<h1><?_l('Collection')?></h1>

<a href = "collection_form.php" class = "add"><img src = "<?=ADMIN?>/images/icon-add.png">&nbsp;&nbsp;&nbsp;<?_l('Add Collection')?></a>

<div class = "clear"></div>

<div class = "page">
<?
  $count = $db->countOfAll('hs_collection');
  $start = setpage($count);
?>
</div>

<div class = "clear"></div>

<table class ="list">
  <tr>
    <th scope="col"><?_l('name')?></th>
    <th scope="col"><?_l('collection')?></th>
    <th scope="col" width = "120"><?_l('status')?></th>
    <th scope="col" width = "120"><?_l('add product')?></th>
    <th scope="col" width = "50"><?_l('edit')?></th>
    <th scope="col" width = "50"><?_l('delete')?></th>
  </tr>
<?
  $rss = $db->query("SELECT * FROM hs_collection ORDER BY pc_name LIMIT $start,".PAGE);
  while ($line = $db->fetchNextObject($rss)){
    $pcid = $db->queryUniqueValue('SELECT p_id FROM hs_product WHERE pc_id='.$line->pc_id);
?>
  <tr>
    <td><?=$line->pc_name?></td>
    <td><?php if($line->pc_group==1){ echo 'General collection'; }else{ echo 'New collection'; }?></td>
    <td><?php if($line->pc_active==1){ echo 'Active'; }else{ echo 'Unactive'; }?></td>
    <td><a href = "product_form.php?aid=<?=$line->pc_id?>" class = "btn"><?_l('add product')?></a></td>
    <td><a href = "collection_edit.php?aid=<?=$line->pc_id?>" class = "btn"><?_l('edit')?></a></td>
<?php
    if($pcid==NULL OR $pcid==''){
?>
    <td><a href = "collection_delete.php?aid=<?=$line->pc_id?>" class = "btn" onClick = "return confirmSubmit()"><?_l('delete')?></a></td>
<?php
    }else{
?>
    <td>&nbsp;</td>
<?php
    }
?>
  </tr>
<?
  }
?>
</table>

</div>

<style>

</style>

<? include "../footer.php" ?>